package com.xuetang9.t9.xinhuaxia.mappers;

import com.xuetang9.t9.xinhuaxia.beans.Goods;
import com.xuetang9.t9.xinhuaxia.beans.UserOrderlist;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface UserOrderlistMapper extends Mapper<UserOrderlist> {

    @Select("select * from user_orderlist")
    @Results(id="userorderlist",value = {

            @Result(property = "user",column = "uo_userId",
                    one =@One(select = "com.xuetang9.t9.xinhuaxia.mappers.UserMapper.selectByPrimaryKey")),
            @Result(property = "orderlists",column = "uo_orderId",
                    one =@One(select = "com.xuetang9.t9.xinhuaxia.mappers.OrderlistMapper.queryByOrderId")),
            @Result(property = "uoOrderid",column = "uo_orderId"),
            @Result(property = "uoUserid",column = "uo_userId"),
            @Result(property = "uoOrdertime",column = "uo_orderTime"),
            @Result(property = "uoShipmentstime",column = "uo_shipmentsTime"),
            @Result(property = "uoArrivaltime",column = "uo_arrivalTime"),
            @Result(property = "uoConfirmreceipttime",column = "uo_confirmReceiptTime"),
            @Result(property = "uoOrderstatus",column = "uo_orderStatus"),
            @Result(property = "uoSaledstatus",column = "uo_saledStatus"),
    })
    List<UserOrderlist> queryAll();
    @Select("select * from user_orderlist where uo_orderId = #{id}")
    @ResultMap("userorderlist")
    UserOrderlist queryById(@Param("id") Long id);

    @Select("select * from user_orderlist where uo_userId = #{id} order by uo_orderId desc")
    @ResultMap("userorderlist")
    List<UserOrderlist> queryByUserId(@Param("id") Long id);
}